Sorensen Dice
Implements the Sørensen-Dice coefficient, also known as Sørensen index (Sørensen, 1948), Dice's coefficient, or Czekanowski's binary (non-quantitative) index between strings.
The strings are first converted to boolean sets of k-shingles (sequences of k characters), then the similarity is computed as \(\frac{2 \times \lVert V_1 \cap V_2 \rVert}{\lVert V_1 \rVert + \lVert V_2 \rVert}\)
Similar to Jaccard index, but this time the similarity is computed as 2 * |V1 inter V2| / (|V1| + |V2|). Distance is computed as 1 - cosine similarity.
The distance is computed as \(1 - similarity(X, Y)\).
References
Sørensen, T. J. (1948). A method of establishing group of equal amplitude in plant sociobiology based on similarity of species content and its application to analyses of the vegetation on danish commons. Kongelige Danske Videnskabernes Selskab.
Author
Thibault Debatty, solonovamax
Functions
Compute and return the profile of s, as defined by Ukkonen (Ukkonen 1992). The profile is the number of occurrences of k-shingles, and is used to compute q-gram similarity, Jaccard index, etc. Pay attention: the memory requirement of the profile can be up to \(k \times \text{size of the string}\)